<?php

namespace App\Models\Agent;

use App\Models\BaseModel;

/**
 * 应用模型层
 *
 * Class Auth
 * @package App\Models\User
 */
class Agent extends BaseModel
{

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'agent';

    /**
     * Indicates if the model should be timestamped.
     * @var bool
     */
    public $timestamps = false;
    public $agentType = [1=>'录音棚',2=>'CP公司',3=>'业内达人',4=>'老师',5=>'制作人',6=>'独立音乐人',7=>'乐手',8=>'词曲人',9=>'媒体人',10=>'自媒体',11=>'证规媒体',12=>'软件渠道',13=>'网红达人',14=>'经纪人'];
    public $statusText = [0=>'正常',2=>'注销',3=>'暂时停用'];
    public $cardType = [1=>'身份证（中国）',2=>'营业执照（中国）',3=>'护照（限海外）',4=>'其他证件（限海外）'];
    public $scale = [0=>'代理0',1=>'代理1',2=>'代理2',3=>'代理3',4=>'代理4',5=>'代理5',6=>'代理6',7=>'代理7'];
    public function users_info(){
        return $this->hasMany('App\Models\User\UsersInfo','software_id', 'software_id');
    }

    public function deal(){
        return $this->hasMany('App\Models\Deal\Deal','user_id','id');
    }

    public function incomeExcel(){
        return $this->hasMany('App\Models\Finance\IncomeExcel', 'agent_id', 'id');
    }

    public function getAgentTypeAttribute($value){
        return $this->agentType[$value];
    }

    public function getCardTypeAttribute($value)
    {
        return $this->cardType[$value];
    }

    public function getScaleTextAttribute($value)
    {
        return $this->scale[$value];
    }

    public function getExpiredTimeAttribute($value){
        return date('Y-m-d',$value);
    }

//    public function getStatusTextAttribute()
//    {
//        return $this->statusText[$this['status']];
//    }
}
